1. Field of the Invention
The present invention relates to client-server applications. More specifically, the present invention relates to a method and an apparatus for reducing reliance on a central data store while maintaining idempotency in a multi-client, multi-server environment.
2. Related Art
In a typical client-server computing model, the requests of a client are uniquely identified on the server side by a request ID. This request ID enables the client to resend a request to the server if a response to the initial request has not been received from the server. When a response has not been received, it is unclear from the client's perspective if the server processed the request and failed to send the response, or the server simply could not process the request. However, sending the request a second time runs the risk that the request may be executed twice on the server.
One way to alleviate this problem is to use an idempotency feature that facilitates the resending of a request and the detection and elimination of duplicates on the server side. This duplicate-detection technique typically uses a unique identifier for each request. If the same identifier is seen again at a later time, the server may return: the previously processed result for the request, a status of the request, an error code, or some other response.
While the idempotency feature alleviates many problems, it creates significant overhead. Note that this technique becomes significantly more complex as the number of clients and servers in the system increases. Furthermore, subsequent requests may not be delivered to the same server that received the previous request. One simple way to solve this problem is for all the servers to share a central data store and to lock an entry for a given request identifier in the central data store. However, the use of such a central data store creates a bottleneck in the system which can hinder scaling of the system.